package main
import (
	"fmt"
	"math"
)
// 5. 常量
func main(){

	//const 不能修改
	const a1 = 10
	// a1 = 20	//不能重新赋值

	var a2 = math.Sqrt(4)
	// const b2 = math.Sqrt(4) //不允许
	fmt.Println("a2=",a2)

	// 字符串常量 无类型的
	var name3 = "yang hao"
	fmt.Printf("\ntype %T value %v", name3, name3)

	// 
	var defaultName  = "yang-hao" //允许
	type myString string
	var newName myString = "yangxiaohao"
	// newName = defaultName //不允许
	newName = "ssssss"
	fmt.Println("defaultName=",defaultName,"newName=",newName)

	const trueConst = true
    type myBool bool
    var defaultBool = trueConst // 允许
    var customBool myBool = trueConst // 允许
    // defaultBool = customBool // 不允许
	fmt.Println("defaultBool=",defaultBool,"customBool=",customBool)


	// 数字常量
	const a = 5
    var intVar int = a
    var int32Var int32 = a
    var float64Var float64 = a
    var complex64Var complex64 = a
    fmt.Println("intVar",intVar, "\nint32Var", int32Var, "\nfloat64Var", float64Var, "\ncomplex64Var",complex64Var)


	var a6 = 5.9/8
    fmt.Printf("a6's type %T value %v",a6, a6)


}